package com.allwees.bs.module.fms.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.allwees.bs.core.modelbase.branch.BranchUser;
import com.allwees.bs.core.modelbase.branch.EBranchType;
import com.allwees.bs.module.base.service.BoService;
import com.allwees.bs.module.fms.entity.MerchantAccount;
import com.allwees.bs.module.fms.req.ApplyWithdrawReq;
import com.allwees.bs.module.fms.req.AuditWithdrawReq;
import com.allwees.bs.module.fms.req.DoBatchWithdrawReq;
import com.allwees.bs.module.fms.req.DoWithDrawFailedReq;
import com.allwees.bs.module.fms.req.DoWithdrawReq;
import com.allwees.bs.module.fms.req.ResetWithdrawPasswordReq;
import com.allwees.bs.module.fms.req.SetWithdrawSecurityInfoReq;
import com.allwees.bs.module.fms.req.query.MerchantAccountQueryReq;
import com.allwees.bs.module.mms.bo.MerchantCreatedBo;

/**
 * 商户账户操作
 *
 * @author yangylsky
 * @since 2019-12-12
 */
public interface MerchantAccountService extends BoService<MerchantAccount> {
    /**
     * 查询商户默认账户
     *
     * @param branchType
     * @param branchUuid
     * @return
     */
    MerchantAccount findDefaultMerchantAccount(EBranchType branchType, String branchUuid);

    /**
     * 查询商户账户分页列表
     *
     * @param page
     * @param req
     * @return
     */
    IPage<MerchantAccount> findPage(Page<MerchantAccount> page, MerchantAccountQueryReq req);

    /**
     * 创建商户账户
     *
     * @param branchType
     * @return
     */
//    MerchantAccount createSupplierAccount(EBranchType branchType, String branchUuid);

    MerchantAccount createRetailerAccount(EBranchType branchType, MerchantCreatedBo bo);

    /**
     * 设置提现安全信息
     *
     * @param req
     * @return
     */
    boolean setWithdrawSecurityInfo(SetWithdrawSecurityInfoReq req);

    /**
     * 重置密码
     *
     * @param req
     * @return
     */
    boolean resetWithdrawPassword(ResetWithdrawPasswordReq req);

    /**
     * 商户申请提现
     *
     * @param req
     * @return
     */
    boolean applyWithdraw(ApplyWithdrawReq req, BranchUser branchUser);

    /**
     * 审核提现申请
     *
     * @param req
     * @return
     */
    int auditWithdraw(AuditWithdrawReq req);

    /**
     * 执行提现
     *
     * @param req
     * @return
     */
    boolean doWithdraw(DoWithdrawReq req);

    /**
     * 提现失败
     *
     * @param req
     * @return
     */
    boolean doWithdrawFailed(DoWithDrawFailedReq req);

    /**
     * 批量执行提现
     *
     * @param req
     * @return
     */
    boolean doBatchWithdraw(DoBatchWithdrawReq req);

}
